<div class="comments">
  <h3 class="comment_header">留言</h3>
  <div class="commenter">
    <% if (user) { %>
    <div class="commenter_field">
      <textarea name="content" id="commenter_text" class="commenter_text" required></textarea>
    </div>
    <input type="submit" class="commenter_button" value="留言" data-id="<%= article._id %>" />
    <% } else { %>
    <div class="commenter_field">
      <a href="/signin?from=<%= originalUrl %>" class="commenter_login">登录</a>
    </div>
    <% } %>
  </div>
  <div class="comments-list">
    <% comments.forEach(function (comment) { %>
    <div class="comment">
      <a href="javascript:;" class="commenter_avatar">
        <% if (comment.author.avatar)  { %>
        <img src="<%= comment.author.avatar %>" alt="<%= comment.author.name %>">
        <% } else {%>
          <%- comment.author.name.substr(0,1) %>
        <% } %>
      </a>
      <div class="content-wrapper simditor">
        <a class="commnet_author" href="/posts?author=<%= comment.author._id %>">
          <%- comment.author.name %>
        </a>
        <div class="comment_content simditor-body"><%- comment.content %></div>
        <% if (user && comment.author._id && user._id.toString() === comment.author._id.toString()) { %>
        <div class="actions">
          <a class="comment_reply" href="javascript:;" data-url="/<%= articleType %>/comment/<%= comment._id %>/remove">删除</a>
        </div>
        <% } %>
      </div>
    </div>
    <% }) %>
  </div>
</div>
